{% extends "base.html" %}

{% block title %}编辑资源信息{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h4 class="mb-0">编辑资源信息</h4>
                </div>
                <div class="card-body">
                    <form method="post">
                        <div class="mb-3">
                            <label for="budget" class="form-label">预算（万元）</label>
                            <input type="number" step="0.01" class="form-control" id="budget" 
                                   name="budget" value="{{ resource.budget if resource else '' }}"
                                   min="0">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">人力资源</label>
                            <div class="row g-3">
                                <div class="col-md-6">
                                    <input type="number" class="form-control" name="engineers" 
                                           placeholder="工程师数量"
                                           value="{{ resource.human_resources.engineers if resource and resource.human_resources else '' }}"
                                           min="0">
                                </div>
                                <div class="col-md-6">
                                    <input type="number" class="form-control" name="technicians" 
                                           placeholder="技术工人数量"
                                           value="{{ resource.human_resources.technicians if resource and resource.human_resources else '' }}"
                                           min="0">
                                </div>
                            </div>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">设备资源</label>
                            <div class="row g-3">
                                <div class="col-md-4">
                                    <input type="number" class="form-control" name="sensors" 
                                           placeholder="传感器数量"
                                           value="{{ resource.equipment.sensors.count if resource and resource.equipment and resource.equipment.sensors else '' }}"
                                           min="0">
                                </div>
                                <div class="col-md-4">
                                    <input type="number" class="form-control" name="controllers" 
                                           placeholder="控制器数量"
                                           value="{{ resource.equipment.controllers.count if resource and resource.equipment and resource.equipment.controllers else '' }}"
                                           min="0">
                                </div>
                                <div class="col-md-4">
                                    <input type="number" class="form-control" name="actuators" 
                                           placeholder="执行器数量"
                                           value="{{ resource.equipment.actuators.count if resource and resource.equipment and resource.equipment.actuators else '' }}"
                                           min="0">
                                </div>
                            </div>
                        </div>
                        <div class="text-end">
                            <a href="{{ url_for('main.project_detail', project_id=project.id) }}" 
                               class="btn btn-secondary">取消</a>
                            <button type="submit" class="btn btn-primary">保存</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 